﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using WCSY.BLL;
using WCSY.MODEL;

public partial class ReportManagement_costExecutDetailReport : System.Web.UI.Page
{
    Fg_deptInfoManager deptM = new Fg_deptInfoManager();
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack){
            //绑定预算部门
            DataTable deptList = deptM.GetAllList().Tables[0];
            this.ddlDept.DataSource = deptList;
            this.ddlDept.DataTextField = "deptname";
            this.ddlDept.DataValueField = "deptno";
            this.ddlDept.DataBind();
            //绑定费用项
            fg_costsManager costsm = new fg_costsManager();
            this.ddlCosts.DataSource = costsm.GetAllList();
            this.ddlCosts.DataTextField = "name";
            this.ddlCosts.DataValueField = "code";
            this.ddlCosts.DataBind();
            //绑定期间
            this.ddlperiod.Items.Add("第一期");
            this.ddlperiod.Items.Add("第二期");
            this.ddlperiod.Items.Add("第三期");
            this.ddlperiod.Items.Add("第四期");
            this.ddlperiod.Items.Add("第五期");
            this.ddlperiod.Items.Add("第六期");
            this.ddlperiod.Items.Add("第七期");
            this.ddlperiod.Items.Add("第八期");
            this.ddlperiod.Items.Add("第九期");
            this.ddlperiod.Items.Add("第十期");
            this.ddlperiod.Items.Add("第十一期");
            this.ddlperiod.Items.Add("第十二期");
            
            wcsy_costsOrderMstManager mstm = new wcsy_costsOrderMstManager();
            string period = ddlperiod.SelectedValue;
            if(!period.Equals("-1")){
                period = ddlperiod.SelectedItem.Text;
            }
            gvBind(mstm.GetActiovOrderListByPara("-1", "-1","","-1"));
            
           
        }
    }

    public void gvBind(DataTable gvdt) {
        this.GridView1.DataSource = gvdt;
        this.GridView1.DataBind();
    }

    /// <summary>
    /// 查询数据
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSec_Click(object sender, EventArgs e)
    {
        wcsy_costsOrderMstManager mstm = new wcsy_costsOrderMstManager();
        string period = ddlperiod.SelectedValue;
        if (!period.Equals("-1"))
        {
            period = ddlperiod.SelectedItem.Text;
        }
        gvBind(mstm.GetActiovOrderListByPara(ddlDept.SelectedValue, ddlCosts.SelectedValue, txtUyear.Text, period));
    }
}
